#pragma once 
#include <QObject>
#include <QtCore/qplugin.h>
#include <QVector>
#include <QAction>
#include <QKeySequence>
#include "Model.h"
#include "Document.h"
#include "Callbacks.h"
#include "Logger.h"

class RichParameterSet;
class StarlabDrawArea;
class PluginManager;
/** 
 * @brief The superclass of any starlab plugin
 *
 * @defgroup StarlabPluginInterfaces Starlab Plugin Interfaces
 */
class StarlabPlugin : public QObject, public Logger{
public:
    /// Default constructor
    StarlabPlugin(){ _action = NULL; }

    /// The longer string describing each filtering action.
    /// => Printed at the top of the parameter window
    /// => You can use html formatting tags (like <br> <b> and <i>) to improve readability.
    /// => Used in the "About plugin" and to create the filter list page.
    virtual QString description() { return "description not available"; }

    /// The very short string (a few words) describing each filtering action
    /// This string is used also to define the menu entry. The defaut name
    /// is the one of the plugin filename which is set by the pluginloader
    /// at boot time.
    virtual QString name() { return metaObject()->className(); }
    
    /// If the plugin has an icon, return it.
    virtual QIcon icon() { return QIcon(); }

    /// @{ @note only overload one of the following
        /// Does the document have what's needed to start this filter? 
        virtual bool isApplicable(Document* /*document*/){ return true; }
    /// @}
    
    /// What shortcut would you like me to use for this plugin?
    virtual QKeySequence shortcut(){ return QKeySequence(); }
    
    /// @{ action management
    private:
        QAction* _action;
    public:
        /// @brief retrieves action associated with plugin. Instantiate it if necessary
        /// @note DO NOT overload this method in your plugin
        virtual QAction* action(){ 
            if(_action==NULL){
                _action = new QAction(icon(),name(),this);
                _action->setToolTip(description());
                _action->setShortcut(shortcut());
            }
            return _action;
        }
    /// @}
};
